package com.kfh.ybracelet.bean;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Aaron on 16/9/7.
 */
public class GoodsInfo implements Parcelable {

    private int code;
    private String code_msg;


    private List<ProductListEntity> productList;


    private List<NewListEntity> newList;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getCode_msg() {
        return code_msg;
    }

    public void setCode_msg(String code_msg) {
        this.code_msg = code_msg;
    }

    public List<ProductListEntity> getProductList() {
        return productList;
    }

    public void setProductList(List<ProductListEntity> productList) {
        this.productList = productList;
    }

    public List<NewListEntity> getNewList() {
        return newList;
    }

    public void setNewList(List<NewListEntity> newList) {
        this.newList = newList;
    }

    public static class ProductListEntity implements Parcelable {
        private String id;
        private String subject;
        private String price;
        private String priceOff;
        private int packageTime;
        private String content;
        private int disable;
        private int type;
        private boolean selected;

        public boolean isSelected() {
            return selected;
        }

        public void setSelected(boolean selected) {
            this.selected = selected;
        }

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getSubject() {
            return subject;
        }

        public void setSubject(String subject) {
            this.subject = subject;
        }

        public String getPrice() {
            return price;
        }

        public void setPrice(String price) {
            this.price = price;
        }

        public String getPriceOff() {
            return priceOff;
        }

        public void setPriceOff(String priceOff) {
            this.priceOff = priceOff;
        }

        public int getPackageTime() {
            return packageTime;
        }

        public void setPackageTime(int packageTime) {
            this.packageTime = packageTime;
        }

        public String getContent() {
            return content;
        }

        public void setContent(String content) {
            this.content = content;
        }

        public int getDisable() {
            return disable;
        }

        public void setDisable(int disable) {
            this.disable = disable;
        }

        public int getType() {
            return type;
        }

        public void setType(int type) {
            this.type = type;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.id);
            dest.writeString(this.subject);
            dest.writeString(this.price);
            dest.writeString(this.priceOff);
            dest.writeInt(this.packageTime);
            dest.writeString(this.content);
            dest.writeInt(this.disable);
            dest.writeInt(this.type);
            dest.writeByte(this.selected ? (byte) 1 : (byte) 0);
        }

        public ProductListEntity() {
        }

        protected ProductListEntity(Parcel in) {
            this.id = in.readString();
            this.subject = in.readString();
            this.price = in.readString();
            this.priceOff = in.readString();
            this.packageTime = in.readInt();
            this.content = in.readString();
            this.disable = in.readInt();
            this.type = in.readInt();
            this.selected = in.readByte() != 0;
        }

        public static final Creator<ProductListEntity> CREATOR = new Creator<ProductListEntity>() {
            @Override
            public ProductListEntity createFromParcel(Parcel source) {
                return new ProductListEntity(source);
            }

            @Override
            public ProductListEntity[] newArray(int size) {
                return new ProductListEntity[size];
            }
        };
    }

    public static class NewListEntity implements Parcelable {

        private String id;
        private String subject;
        private String price;
        private String priceOff;
        private int packageTime;
        private String content;
        private int disable;
        private int type;
        private boolean selected;

        public boolean isSelected() {
            return selected;
        }

        public void setSelected(boolean selected) {
            this.selected = selected;
        }

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getSubject() {
            return subject;
        }

        public void setSubject(String subject) {
            this.subject = subject;
        }

        public String getPrice() {
            return price;
        }

        public void setPrice(String price) {
            this.price = price;
        }

        public String getPriceOff() {
            return priceOff;
        }

        public void setPriceOff(String priceOff) {
            this.priceOff = priceOff;
        }

        public int getPackageTime() {
            return packageTime;
        }

        public void setPackageTime(int packageTime) {
            this.packageTime = packageTime;
        }

        public String getContent() {
            return content;
        }

        public void setContent(String content) {
            this.content = content;
        }

        public int getDisable() {
            return disable;
        }

        public void setDisable(int disable) {
            this.disable = disable;
        }

        public int getType() {
            return type;
        }

        public void setType(int type) {
            this.type = type;
        }


        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.id);
            dest.writeString(this.subject);
            dest.writeString(this.price);
            dest.writeString(this.priceOff);
            dest.writeInt(this.packageTime);
            dest.writeString(this.content);
            dest.writeInt(this.disable);
            dest.writeInt(this.type);
            dest.writeByte(this.selected ? (byte) 1 : (byte) 0);
        }

        public NewListEntity() {
        }

        protected NewListEntity(Parcel in) {
            this.id = in.readString();
            this.subject = in.readString();
            this.price = in.readString();
            this.priceOff = in.readString();
            this.packageTime = in.readInt();
            this.content = in.readString();
            this.disable = in.readInt();
            this.type = in.readInt();
            this.selected = in.readByte() != 0;
        }

        public static final Creator<NewListEntity> CREATOR = new Creator<NewListEntity>() {
            @Override
            public NewListEntity createFromParcel(Parcel source) {
                return new NewListEntity(source);
            }

            @Override
            public NewListEntity[] newArray(int size) {
                return new NewListEntity[size];
            }
        };
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.code);
        dest.writeString(this.code_msg);
        dest.writeList(this.productList);
        dest.writeList(this.newList);
    }

    public GoodsInfo() {
    }

    protected GoodsInfo(Parcel in) {
        this.code = in.readInt();
        this.code_msg = in.readString();
        this.productList = new ArrayList<ProductListEntity>();
        in.readList(this.productList, ProductListEntity.class.getClassLoader());
        this.newList = new ArrayList<NewListEntity>();
        in.readList(this.newList, NewListEntity.class.getClassLoader());
    }

    public static final Parcelable.Creator<GoodsInfo> CREATOR = new Parcelable.Creator<GoodsInfo>() {
        @Override
        public GoodsInfo createFromParcel(Parcel source) {
            return new GoodsInfo(source);
        }

        @Override
        public GoodsInfo[] newArray(int size) {
            return new GoodsInfo[size];
        }
    };
}
